from toee import *
from utilities import *
from InventoryRespawn import *

def san_dialog( attachee, triggerer ):
	triggerer.begin_dialog( attachee, 1 )
	return SKIP_DEFAULT

def san_first_heartbeat(attachee, triggerer):
	game.timevent_add(respawn, (attachee), 86400000 ) #86400000ms is 24 hours
	game.new_sid = 0
	return RUN_DEFAULT

def san_dying( attachee, triggerer ):
	game.global_flags[297] = 1
	if game.global_flags[294] == 1:
		game.party[0].reputation_add( 24 )
		return RUN_DEFAULT
	game.global_vars[23] = game.global_vars[23] + 1
	if (game.global_vars[23] >= 2):
		game.party[0].reputation_add( 1 )
	return RUN_DEFAULT

def master( attachee, triggerer ):
	game.global_vars[33] = 3
	npc = find_container_near(attachee,1001)
	#npc.obj_set_int( obj_f_container_inventory_source, 358 )
	game.timevent_add( RespawnInventory, ( npc, 358 ), 604800000 ) #604800000ms is 1 week
	game.timevent_add( will_sell, ( attachee, ), 604800000 ) #604800000ms is 1 week
	return RUN_DEFAULT

def will_sell( attachee ):
	game.global_vars[33] = 4
	return RUN_DEFAULT